<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>个人中心</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <style>
        html,
        body {
            width: 100%;
            min-height: 100%;
            background: #f2efed;
            line-height: 1;
        }
        /*联系人列表*/
        /*弹出的字母框*/

        #letter {
            width: 3rem;
            height: 3rem;
            border-radius: 50%;
            font-size: 2.5rem;
            color: #fff;
            text-align: center;
            line-height: 3rem;
            background: rgba(0, 0, 0, .5);
            position: fixed;
            left: 50%;
            top: 50%;
            margin: -50px 0 0 -50px;
            z-index: 99;
            display: none
        }

        #letter img {
            width: 2.5rem;
            height: 2.5rem;
            float: left;
            margin: 1.25rem 0 0 1.25rem;
        }
        /*列表*/

        .sort_box {
            margin: 0;
        }

        .sort_list {
            padding: 0.45rem 0;
            background-color: #fff;
            display: flex;
            align-items: center;
            position: relative;
        }

        .sort_list::after {
            content: "";
            height: 1px;
            width: calc(100% - 0.75rem);
            position: absolute;
            background: #edeae8;
            bottom: 0;
            left: 0.75rem;
        }

        .sort_list .num_logo {
            width: 1.5rem;
            margin: 0rem 0.75rem;
        }

        .sort_list .num_name {
            font-size: 0.8rem;
            color: #333;
        }

        .sort_letter {
            padding: 0.5rem 0rem;
            margin-left: 0.75rem;
            font-size: 0.7rem;
            color: #666666;
        }
        /*字母列表*/

        .initials {
            position: fixed;
            top: 47px;
            right: 0;
            height: 100%;
            width: 15px;
            padding-right: 10px;
            text-align: center;
            font-size: 12px;
            z-index: 99;
            background: transparent!important;
        }

        .indexes_list {
            position: absolute;
            top: 50%;
            right: 0.45rem;
            transform: translateY(-50%);
        }

        .indexes_list li {
            list-style: none;
            height: 0.6rem!important;
            font-size: 0.5rem;
            color: #999999;
        }

        .yq_btn {
            position: absolute;
            right: 0.75rem;
            top: 50%;
            transform: translateY(-50%);
        }

        .yq_btn span {
            background: #0bc218;
            color: #fff;
            border-radius: 3px;
            padding: 0.3rem 0.6rem;
        }
    </style>
</head>

<body>

    <div id="app">

        <!-- 联系人列表 -->
        <div id="letter"></div>
        <div class="sort_box">
            <div v-for="friend_info in data" class="sort_list">
                <div class="num_logo">
                    <div style="background:url(../../image/four/mine_off.png) center/cover no-repeat;width:1.5rem;height:1.5rem;'"></div>
                </div>
                <div v-if="friend_info.fullName" class="num_name">{{friend_info.fullName}}</div>
                <div v-else class="num_name">该用户很懒，没有填写名字</div>
                <div class="yq_btn" @click="send_msg(friend_info.phones[0])"><span>+邀请好友</span></div>
            </div>

        </div>
        <div class="initials">
            <ul class="indexes_list">

            </ul>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/jquery.min.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/jquery.charfirst.pinyin.js"></script>
<script type="text/javascript" src="../../script/sort.js"></script>
<script type="text/javascript">
    apiready = function() {

        var contacts = api.require('contacts');
        api.showProgress({
            title: '努力加载中...',
            text: '先喝杯茶...',
            modal: false
        });

        var app = new Vue({
            el: '#app',
            data: {
                data: [],
            },
            created: function() {
                var $_this = this;
                contacts.queryByPage({
                    pageIndex: 0
                }, function(ret, err) {
                    if (ret) {
                        $_this.data = ret.contacts;
                        $_this.$nextTick(function() {
                            list_paixu();
                        })
                    } else {
                        alert(JSON.stringify(err));
                    }
                });
            },
            mounted: function() {
                api.hideProgress();
                var $_this = this;
            },
            methods: {
                // 发送短信
                send_msg: function(obj) {
                    console.log(obj['呼叫手机']);
                    api.sms({
                        numbers: [obj['呼叫手机']],
                        text: '邀请你成为小鸟云创的一份子，赶快来注册吧![小鸟云创]',
                        silent:true
                    }, function(ret, err) {
                        if (ret && ret.status) {
                            //已发送
                            api.toast({
                                msg: '短信已发送',
                                duration: 2000,
                                location: 'bottom'
                            });

                        } else {
                            //发送失败
                            api.toast({
                                msg: '短信发送失败',
                                duration: 2000,
                                location: 'bottom'
                            });
                        }
                    });
                }
            }
        })

    };
</script>

</html>
